package com.itheima.myinner.text5;

public class calculatorDemo {
    public static void main(String[] args) {
        Calculator c = (int a,int b)->{return a+b;};
        useCalculator((int a,int b)->{return a+b;});
    }
    //定义一个方法
    public static void useCalculator(Calculator calculator){
        int result = calculator.calc(10,20);
        System.out.println(result);
    }
}

//定义一个接口一个抽象方法
interface Calculator{
    int calc(int a,int b);
}